<template>
  <div class="app-container">
    <div style="display: flex; justify-content: space-between">
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="Plus"
            @click="handleAdd"
            v-hasPermi="['attendance:shift:add']"
            >新增班次</el-button
          >
        </el-col>
      </el-row>
      <!-- 全部班次表单搜索框-->
      <el-form
        :model="queryParams"
        ref="queryRef"
        :inline="true"
        style="display: flex"
      >
        <el-form-item>
          <el-select
            v-model="queryParams.type"
            filterable
            placeholder="全部班次"
            style="width: 180px"
            @change="queryAttendanceType(queryParams.type)"
          >
            <el-option
              v-for="dict in sys_shift_type"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input
            v-model="queryParams.name"
            style="max-width: 200px; margin-left: 10px"
            placeholder="请输入班次名称"
            clearable
            @change="queryAttendanceName(queryParams.name)"
          >
            <template #append>
              <el-button :icon="Search" />
            </template>
          </el-input>
        </el-form-item>
      </el-form>
    </div>
    <el-table
      v-loading="loading"
      :data="postList"
      @selection-change="handleSelectionChange"
      :default-sort="{ prop: 'postId', order: 'descending' }"
    >
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
      <el-table-column
        label="班次名称"
        align="center"
        prop="name"
        width="180"
      />
      <el-table-column label="考勤时间" align="center">
        <template #default="scope">
          {{ scope.row.officeTime }}-{{ scope.row.closingTime }}
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template #default="scope">
          <el-button
            link
            type="primary"
            icon="Edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['attendance:shift:edit']"
            >修改</el-button
          >
          <el-button
            link
            type="primary"
            icon="Delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['attendance:shift:remove']"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修班次对话框 -->
    <el-drawer :title="title" v-model="open" direction="rtl">
      <template #default>
        <div>
          <div>
            <el-form :model="form" :rules="rules" ref="postRef">
              <el-form-item label="班次名称" prop="name">
                <el-input
                  v-model="form.name"
                  placeholder="请输入班次名称"
                  style="width: 240px"
                />
              </el-form-item>
              <el-form-item label="班次负责人" prop="principalId">
                <el-select
                  v-model="form.principalId"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="item in orgSearchAgList"
                    :key="item.userId"
                    :label="item.nickName"
                    :value="item.userId"
                  />
                </el-select>
              </el-form-item>
              <el-form-item>
                <div>
                  <div style="display: flex; align-items: center">
                    <el-form-item
                      label="上下班时间"
                      prop="form.postTime"
                      style="margin-top: 17px"
                    >
                    </el-form-item>
                    <!-- <div style="display: flex; align-items: center">
                    <el-button type="primary" link @click="addWorkListClick">添加</el-button>
                    <el-button type="primary" link @click="dialogVisible = true" style="margin-top: 15px;">设置打卡时段</el-button>
                  </div> -->
                  </div>
                  <div
                    style="
                      width: 540px;
                      height: 150px;
                      margin-bottom: 10px;
                      background-color: rgba(23, 26, 29, 0.04);
                      border: 1px solid #f0f0f0;
                      border-radius: 6px;
                    "
                  >
                    <div
                      style="
                        min-height: 36px;
                        padding: 0 12px;
                        font-size: 14px;
                        border-bottom: 1px solid #f0f0f0;
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
                      "
                    >
                      上下班时间
                    </div>
                    <div
                      style="
                        display: flex;
                        flex-direction: column;
                        margin-top: 20px;
                        margin-left: 10px;
                        margin-right: 10px;
                      "
                    >
                      <div
                        style="
                          display: flex;
                          height: 32px;
                          line-height: 32px;
                          margin-bottom: 8px;
                          justify-content: space-between;
                        "
                      >
                        <div style="font-size: 14px">
                          <span style="margin-right: 10px">上班时间</span>
                          <el-time-picker
                            @change="inTime"
                            v-model="form.officeTime"
                            placeholder="请选择时间"
                            value-format="HH:mm:ss"
                            style="width: 100px; border-radius: 4px"
                          />
                        </div>
                        <!-- <div>
                        <el-checkbox v-model="dkTimeUp" disabled>打卡</el-checkbox>
                      </div> -->
                      </div>
                      <div>
                        <div
                          style="
                            display: flex;
                            height: 32px;
                            line-height: 32px;
                            margin-bottom: 8px;
                            justify-content: space-between;
                          "
                        >
                          <div style="font-size: 14px">
                            <span style="margin-right: 10px">下班时间</span>
                            <el-time-picker
                              v-model="form.closingTime"
                              @change="outTime"
                              placeholder="请选择时间"
                              value-format="HH:mm:ss"
                              style="width: 100px; border-radius: 4px"
                            />
                          </div>
                          <!-- <div>
                          <el-checkbox v-model="dkTimeDown">打卡</el-checkbox>
                        </div> -->
                        </div>
                      </div>
                    </div>
                  </div>
                  <!-- <div
                  v-for="(item, index) in dkList"
                  :key="index"
                  style="width: 540px; height: 150px; margin-bottom: 10px; background-color: rgba(23, 26, 29, 0.04); border: 1px solid #f0f0f0; border-radius: 6px"
                >
                  <div style="min-height: 36px; padding: 0 12px; font-size: 14px; border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between">
                    第{{ index + 1 }}次上下班
                    <el-icon v-if="dkList.length > 1" @click="delDkDiv(item.id, index)"><Close /></el-icon>
                  </div>
                  <div style="display: flex; flex-direction: column; margin-top: 20px; margin-left: 10px; margin-right: 10px">
                    <div style="display: flex; height: 32px; line-height: 32px; margin-bottom: 8px; justify-content: space-between">
                      <div style="font-size: 14px">
                        <span style="margin-right: 10px">上班时间</span>
                        <el-time-picker @change="inTime" v-model="timeDown[index]" placeholder="请选择" style="width: 100px; border-radius: 4px" />
                      </div>
                      <div>
                        <el-checkbox v-model="dkTimeUp[index]" disabled>打卡</el-checkbox>
                      </div>
                    </div>
                    <div>
                      <div style="display: flex; height: 32px; line-height: 32px; margin-bottom: 8px; justify-content: space-between">
                        <div style="font-size: 14px">
                          <span style="margin-right: 10px">下班时间</span>
                          <el-time-picker v-model="timeDown[index]" @change="outTime" placeholder="请选择" style="width: 100px; border-radius: 4px" />
                        </div>
                        <div>
                          <el-checkbox v-model="dkTimeDown[index]">打卡</el-checkbox>
                        </div>
                      </div>
                    </div>
                  </div>
                </div> -->
                </div>
              </el-form-item>
              <el-form-item>
                <div>
                  <div
                    style="
                      margin-bottom: 8px;
                      font-size: 14px;
                      cursor: pointer;
                      display: flex;
                      align-items: center;
                    "
                  >
                    <el-checkbox
                      v-model="form.isRest"
                      @change="form.isRest == false ? 0 : 1"
                      >休息时间</el-checkbox
                    >
                    <!-- <span>休息时间</span> -->
                  </div>
                  <div
                    v-if="form.isRest == 1"
                    style="
                      display: flex;
                      height: 32px;
                      line-height: 32px;
                      margin-bottom: 8px;
                    "
                  >
                    <div style="font-size: 14px">
                      <span style="margin-right: 10px">休息开始:</span>
                      <el-time-picker
                        v-model="form.restBeginTime"
                        placeholder="请选择时间"
                        value-format="HH:mm:ss"
                        style="width: 120px; border-radius: 4px"
                      />
                    </div>
                    <div style="font-size: 14px; margin-left: 20px">
                      <span style="margin-right: 10px">休息结束:</span>
                      <el-time-picker
                        v-model="form.restEndTime"
                        placeholder="请选择时间"
                        value-format="HH:mm:ss"
                        style="width: 120px; border-radius: 4px"
                        @change="handleEndTime"
                      />
                    </div>
                  </div>
                </div>
              </el-form-item>
              <!-- <div style="margin-top: 20px">
                <div style="margin-bottom: 8px; font-size: 14px; cursor: pointer; display: flex; align-items: center">
                  <el-checkbox v-model="restimecheckbox">休息时间</el-checkbox>
                  <el-tooltip class="box-item" effect="dark" :visible="!buttonType" :content="contentRest" placement="top">
                    <span @click="addRestTime" :class="{ buttonTypeClass: !buttonType }" class="addClasses">添加</span>
                  </el-tooltip>
                </div>
                <div v-for="(item, index) in reatNumberList" style="display: flex; height: 32px; line-height: 32px; margin-bottom: 8px">
                  <div style="font-size: 14px">
                    <span style="margin-right: 10px">休息开始:</span>
                    <el-time-picker v-model="restimeListStart[index]" placeholder="请选择时间" style="width: 120px; border-radius: 4px" />
                  </div>
                  <div style="font-size: 14px; margin-left: 20px">
                    <span style="margin-right: 10px">休息结束:</span>
                    <el-time-picker v-model="restimeListEnd[index]" placeholder="请选择时间" style="width: 120px; border-radius: 4px" />
                  </div>
                  <div @click="delRestDiv(item.id, index)">
                    <el-icon v-if="reatNumberList.length > 1" style="margin-left: 10px"><CircleClose /></el-icon>
                  </div>
                </div>
              </div> -->
              <el-form-item>
                <div style="margin-top: -15px">
                  <p style="font-size: 14px">弹性打卡</p>
                  <el-checkbox-group
                    v-model="elasticityTypeList"
                    style="
                      display: flex;
                      flex-direction: column;
                      font-size: 14px;
                    "
                    @change="changeCheckBox"
                  >
                    <el-checkbox label="允许晚到晚走、早到早走" :value="1" />
                    <div v-if="form.elasticityType == 1">
                      <div>
                        <span style="margin-right: 10px">上班最多可晚到：</span>
                        <div style="display: inline-block">
                          <cascader-timeSe
                            :endHour="12"
                            :endMinute="59"
                            :defaultSelectedTime="[
                              form.offHoursNum,
                              form.offMinuteNum,
                            ]"
                            @timeChange="handleTimeChange"
                          />
                        </div>
                        <span style="margin-left: 10px"
                          >上班晚到几分钟，下班须晚走几分钟</span
                        >
                      </div>
                      <div style="margin-top: 10px">
                        <span style="margin-right: 10px">下班最多可早走：</span>
                        <div style="display: inline-block">
                          <cascader-timeSe
                            :endHour="12"
                            :endMinute="59"
                            :defaultSelectedTime="[
                              form.closeHoursNum,
                              form.closeMinuteNum,
                            ]"
                            @timeChange="handleTimeChangeOff"
                          />
                        </div>

                        <span style="margin-left: 10px"
                          >上班早到几分钟，下班可早走几分钟</span
                        >
                      </div>
                    </div>
                    <el-checkbox
                      label="晚到、早走几分钟不记为异常"
                      :value="2"
                    />
                    <div v-if="form.elasticityType == 2">
                      <div>
                        <span style="margin-right: 10px">上班最多可晚到：</span>
                        <div style="display: inline-block">
                          <cascader-timeSe
                            :endHour="12"
                            :endMinute="59"
                            :defaultSelectedTime="[
                              form.offHoursNum,
                              form.offHoursNum,
                            ]"
                            @timeChange="handleTimeChange"
                          />
                        </div>
                        <span style="margin-left: 10px"
                          >上班晚到几分钟，下班须晚走几分钟</span
                        >
                      </div>
                      <div style="margin-top: 10px">
                        <span style="margin-right: 10px">下班最多可早走：</span>
                        <div style="display: inline-block">
                          <cascader-timeSe
                            :endHour="12"
                            :endMinute="59"
                            :defaultSelectedTime="[
                              form.closeHoursNum,
                              form.closeMinuteNum,
                            ]"
                            @timeChange="handleTimeChangeOff"
                          />
                        </div>
                        <span style="margin-left: 10px"
                          >早走1小时内不算早退</span
                        >
                      </div>
                    </div>
                    <!-- <el-checkbox label="下班晚走，第二天可晚到" value="3" />
                    <div
                      v-if="form.elasticityType == 3"
                      style="font-size: 12px"
                    >
                      <div>
                        <el-radio-group v-model="form.offDutyHoursNum">
                          <el-radio :value="2"
                            >仅下班的内勤打卡计算为晚走</el-radio
                          >
                          <el-radio :value="6"
                            >下班的内勤，外勤打卡均计算为晚走</el-radio
                          >
                        </el-radio-group>
                      </div>
                      <div>
                        <p style="color: #c4c4c4">晚走规则1</p>
                        <div style="margin-top: 10px">
                          <span style="margin-right: 10px"
                            >第一天下班后晚走</span
                          >
                          <el-time-picker
                            v-model="form.offDutyHoursNum"
                            placeholder="请选择时间"
                            style="width: 120px; border-radius: 4px"
                          />
                          <span style="margin-left: 10px">小时,</span>
                          <span>第二天上班可以晚到</span>
                          <el-time-picker
                            v-model="form.officeLateHoursNum"
                            placeholder="请选择时间"
                            style="width: 120px; border-radius: 4px"
                          />
                          <span style="margin-left: 10px">小时</span>
                        </div>
                        <p style="color: #c4c4c4">
                          第一天21:00下班，第二天10:00上班不算迟到
                        </p>
                      </div>
                    </div> -->
                  </el-checkbox-group>
                </div>
              </el-form-item>
              <el-form-item>
                <div style="margin-top: 24px">
                  <div style="font-size: 14px">
                    <span>班次工时</span>
                    <span style="margin-left: 6px; color: rgba(25, 31, 37, 0.4)"
                      >(考勤统计工作时长及请假出差外出统计，会以此时间为准)</span
                    >
                  </div>
                  <div style="font-size: 14px; margin-top: 10px">
                    <span>合计工作时长{{ workingHoursDay }},</span>
                    <span>计为</span>
                    <el-input-number
                      v-model="form.shiftAttendanceDay"
                      :min="1"
                      :max="60"
                      controls-position="right"
                      style="width: 100px; margin-left: 10px"
                    />
                    <span style="margin-left: 10px">天出勤</span>
                  </div>
                </div>
              </el-form-item>
              <div
                style="
                  margin-bottom: 10px;
                  border-top: 1px solid rgb(228, 228, 228);
                  margin-top: 20px;
                "
              ></div>
              <!-- <div>
                更多设置
                <el-icon @click="upclick" v-if="upclick1 == false"
                  ><ArrowUp
                /></el-icon>
                <el-icon @click="upclick" v-else><ArrowDown /></el-icon>
              </div> -->
              <el-form-item>
                <div v-if="upclick1 == true">
                  <div>
                    <el-checkbox label="严重迟到分钟数" value="1" />
                    <el-input-number
                      v-model="form.severityLateMinuteNum"
                      :min="1"
                      :max="60"
                      controls-position="right"
                      style="width: 100px; margin-left: 10px"
                    />
                  </div>
                  <div>
                    <el-checkbox label="旷工迟到分钟数" value="2" />
                    <el-input-number
                      v-model="form.absenteeismLateMinuteNum"
                      :min="1"
                      :max="60"
                      controls-position="right"
                      style="width: 100px; margin-left: 10px"
                    />
                  </div>
                </div>
              </el-form-item>
            </el-form>
          </div>
        </div>
      </template>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-drawer>
    <!-- 班次负责人select嵌套对话框 -->
    <el-dialog
      v-model="classuser1"
      title="选择负责人"
      width="700"
      align-center
      style="text-align: center"
    >
      <span>
        <el-transfer
          v-model="classvalue"
          filterable
          filter-placeholder="请输入"
          :data="dataTr"
        />
      </span>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="classuser1 = false">取消</el-button>
          <el-button type="primary" @click="classuser1 = false">
            确定
          </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup name="Shift">
import {
  shiftListPost,
  shiftGetPost,
  shiftAddPost,
  shiftUpdatePost,
  shiftDelPost,
  getOrgSearchAgApi,
} from "@/api/attendance/shift";
import { Search } from "@element-plus/icons-vue";
import { ref } from "vue";
import cascaderTimeSe from "./cascaderTimeSe.vue";

const { proxy } = getCurrentInstance();
const { sys_shift_type } = proxy.useDict("sys_shift_type");
const postList = ref([]);
const open = ref(false);
const loading = ref(true);
const ids = ref([]);
const upclick1 = ref(false);
// 新增班次负责人穿梭框数据
const classvalue = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const classuser1 = ref(false);
// 穿梭框
const generateData = () => {
  const data = [];
  for (let i = 1; i <= 15; i++) {
    data.push({
      key: i,
      label: `Option ${i}`,
      disabled: i % 4 === 0,
    });
  }
  return data;
};
const dataTr = ref(generateData());
// const transfer = ref([])
const upclick = () => {
  upclick1.value = !upclick1.value;
};
const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
  },
  rules: {
    name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
  },
});

const form = ref({
  name: "测试", //班次名称
  principalId: "", //班次负责人
  officeTime: "09:00:00", //上班时间
  closingTime: "18:00:00", //下班时间
  isRest: 0, //是否有休息时间
  restBeginTime: "12:00:00", //休息开始时间
  restEndTime: "14:00:00", //休息结束时间
  elasticityType: 0, //是否可以弹性打卡
  offHoursNum: 0, //上班最多可晚到-时
  offMinuteNum: 0, //上班最多可晚到-分
  closeHoursNum: 1, //下班最多可晚走-时
  closeMinuteNum: 1, //下班最多可晚走-分
  shiftAttendanceDay: 1, //班次工时
  // severityLateMinuteNum: 1,//严重迟到分钟数
  // absenteeismLateMinuteNum: 1,//严重旷工
});

const { queryParams, rules } = toRefs(data);

/**
 * 获取有管理考勤打卡资格的用户信息
 */
const orgSearchAgList = ref([]);
const getOrgSearchAg = () => {
  getOrgSearchAgApi().then((res) => {
    orgSearchAgList.value = res.data;
  });
};

const elasticityTypeList = ref([]);
/**
 * 弹性打卡复选框判断
 * @param val
 */
const changeCheckBox = (val) => {
  form.value.offHoursNum = 0;
  form.value.offMinuteNum = 0;
  form.value.closeHoursNum = 0;
  form.value.closeMinuteNum = 0;
  form.value.elasticityType = val[val.length - 1];
  elasticityTypeList.value = [];
  elasticityTypeList.value[0] = val[val.length - 1];
};

/**
 * 选择上班最多可早到
 * @param val
 */
const handleTimeChange = (val) => {
  form.value.offHoursNum = val[0];
  form.value.offMinuteNum = val[1];
};
/**
 * 选择下班最多可晚走
 * @param val
 */
const handleTimeChangeOff = (val) => {
  form.value.closeHoursNum = val[0];
  form.value.closeMinuteNum = val[1];
};

const workingHoursDay = ref("");
const workingHoursRe = ref([]);

// 上班时间
const inTime = (e) => {
  // let hours = e.getHours();
  // let minutes = e.getMinutes();
  // let seconds = e.getSeconds();
  // form.value.officeTime = { hours, minutes, seconds };
};
// 下班时间
const outTime = (e) => {
  // let hours = e.getHours();
  // let minutes = e.getMinutes();
  // let seconds = e.getSeconds();
  // form.value.closingTime = { hours, minutes, seconds };
  const { hours, minutes, seconds } = getTimeDifference(
    form.value.officeTime,
    form.value.closingTime
  );
  workingHoursRe.value = [hours, minutes, seconds];
  workingHoursDay.value = hours + "时" + minutes + "分" + seconds + "秒";
  form.value.shiftHours = `${hours},${minutes},${seconds}`;
};

/**
 * 有休息时间时计算每天工时
 */
const handleEndTime = () => {
  const { hours, minutes, seconds } = getTimeDifference(
    form.value.restBeginTime,
    form.value.restEndTime
  );
  workingHoursDay.value = `${workingHoursRe.value[0] - hours}时${
    workingHoursRe.value[1] - minutes
  }分${workingHoursRe.value[2] - seconds}秒`;
  form.value.shiftHours = `${workingHoursRe.value[0] - hours},${
    workingHoursRe.value[1] - minutes
  },${workingHoursRe.value[2] - seconds}`;
};

/**
 * 计算每天工时
 * @param time1
 * @param time2
 */
function getTimeDifference(time1, time2) {
  // 将时间转换为毫秒
  function toMilliseconds(time) {
    let milliseconds = Date.parse("1970-01-01T" + time + "Z");
    return milliseconds;
  }
  // 计算两个时间的毫秒差值
  let diff = toMilliseconds(time2) - toMilliseconds(time1);
  // 将差值转换为小时和分钟
  let diffHours = Math.floor(diff / 3600000); // 3600000毫秒=1小时
  let diffMinutes = Math.floor((diff % 3600000) / 60000); // 60000毫秒=1分钟
  let diffSeconds = Math.floor((diff % 60000) / 1000);
  // 返回小时和分钟的对象
  return {
    hours: diffHours,
    minutes: diffMinutes,
    seconds: diffSeconds,
  };
}

/** 查班次列表 */
function getList() {
  loading.value = true;
  shiftListPost(queryParams.value).then((response) => {
    postList.value = response.rows;
    total.value = Number(response.total);
    loading.value = false;
  });
}
getList();

/** 取消按钮 */
function cancel() {
  open.value = false;
  reset();
}

/** 表单重置 */
function reset() {
  form.value = {
    name: undefined,
  };
  proxy.resetForm("postRef");
}

/** 多选框选中数据 */
function handleSelectionChange(selection) {
  ids.value = selection.map((item) => item.postId);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 新增按钮操作 */
function handleAdd() {
  reset();
  open.value = true;
  title.value = "新增班次";
  getOrgSearchAg();
}

/** 修改按钮操作 */
function handleUpdate(row) {
  reset();
  const postId = row.id;
  getOrgSearchAg();
  shiftGetPost(postId).then((response) => {
    form.value = response.data;
    form.value.isRest = form.value.isRest == 1 ? true : false;
    // 重置弹性打卡
    if (form.value.shiftHours) {
      elasticityTypeList.value[0] = response.data.elasticityType;
      const work = form.value.shiftHours.split(",");
      workingHoursDay.value = `${work[0]}时${work[1]}分${work[2]}秒`;
    } else {
      elasticityTypeList.value[0] = 0;
    }
    form.value.shiftAttendanceDay = Number(form.value.shiftAttendanceDay);

    open.value = true;
    title.value = "编辑班次";
  });
}
/** 提交按钮 */
function submitForm() {
  form.value.isRest = form.value.isRest == true ? 1 : 0;

  proxy.$refs["postRef"].validate((valid) => {
    if (valid) {
      if (form.value.id != undefined) {
        delete form.value.userId;
        delete form.value.deptId;
        shiftUpdatePost(form.value).then((response) => {
          proxy.$modal.msgSuccess("修改成功");
          open.value = false;
          getList();
        });
      } else {
        shiftAddPost(form.value).then((response) => {
          proxy.$modal.msgSuccess("新增成功");
          open.value = false;
          getList();
        });
      }
    }
  });
}

/** 删除按钮操作 */
function handleDelete(row) {
  const idList = row.id;
  proxy.$modal
    .confirm('是否确认删该班次"' + row.name + '"的数据项？')
    .then(function () {
      shiftDelPost(idList);
      setTimeout(() => {
        getList();
        proxy.$modal.msgSuccess("删除成功");
      }, 500);
    });
}

/**
 * 按照名字查找班次
 * @param name
 */
const queryAttendanceName = (name) => {
  queryParams.value.name = name;
  queryParams.value.pageNum = 1;
  getList();
};

/**
 * 按照类型查询班次
 * @param type
 */
const queryAttendanceType = (type) => {
  queryParams.value.type = type;
  queryParams.value.pageNum = 1;
  getList();
};
</script>
<style scoped>
.el-form-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
:deep(.el-drawer__header) {
  border-bottom: 1px solid gainsboro;
  height: 60px;
  margin-bottom: -5px;
}
.buttonTypeClass {
  color: #ccc !important;
  /* pointer-events: none; */
}
.addClasses {
  margin-left: 10px;
  font-size: 14px;
  color: #409eff;
}
</style>
